import Vue from 'vue';
import Message from 'muse-ui-message'
import Toast from 'muse-ui-toast'


export default {
    showAlert(msg,cb1,type) {
        Message.alert(msg, '提示', {
            okLabel: '知道了',
            type:type
        }).then(function () {
            if (cb1) {
                cb1()
            }
        })
    },

    showMsg(msg, type) {
        const obj = {
            'message': Toast.message,
            'success': Toast.success,
            'info': Toast.info,
            'warning': Toast.warning,
            'error': Toast.error,
        }
        obj[type](msg);
    },

    mixin(obj, target, state) {
		Object.keys(obj).forEach(function(key) {
			if(state)  {
				target[key] = obj[key];
			}else {
				if(!target[key])
					target[key] = obj[key];
			}
		});
		return target;
	}
}
